home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / prg_casm / snpd9611.zip / BRESNHAM.C < prev    next >
Text File  |  1996-11-24  |  892b  |  34 lines

  1. .I 0 2
  2. /* +++Date last modified: 27-Oct-1996 */
  3.  
  4. .I 4 2
  5. ** Circle algorithm and other stuff rewritten by Kurt Kuzba
  6. **
  7. .I 52 3
  8.             steep =  x;   x =  y;   y = steep;  /* swap  x and  y */
  9.             steep = dx;  dx = dy;  dy = steep;  /* swap dx and dy */
  10.             steep = sx;  sx = sy;  sy = steep;  /* swap sx and sy */
  11. .D 54 9
  12. .I 65 1
  13.       for(i = 0; i < dx; i++)
  14. .D 66 1
  15. .I 90 12
  16.       int x = 0, d = 2 * (1 - r), w = 2 * SCREEN_WIDTH / SCREEN_HEIGHT;
  17.  
  18.       while(r >= 0)
  19.       {
  20.             plotdot(xc + x, yc + r, c);
  21.             plotdot(xc + x, yc - r, c);
  22.             plotdot(xc - x, yc + r, c);
  23.             plotdot(xc - x, yc - r, c);
  24.             if (d + r > 0)
  25.                   d -= (w * --r) - 1;
  26.             if (x > d)
  27.                   d += (2 * ++x) + 1;
  28. .D 91 18
  29. .I 113 3
  30. #ifndef __TURBOC__
  31.  #include "bc_rand.h"
  32. #endif
  33. .D 114 1
  34.